export class Utils {
    static randomRange(min: number, max: number) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    }

    static getServerBaseUrl() {
        if (window.location.hostname != "localhost") {
            return window.location.protocol + "//" + window.location.hostname + "/";
        }
        return window.location.protocol + "//175.27.156.196/";
    }

    static keepOnlyChinese(str: string) {
        // 使用正则表达式匹配所有中文字符
        return str.replace(/[^\u4E00-\u9FFF\u3400-\u4DBF\uF900-\uFAFF]/g, '');
    }
}